#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,m;
    cin >> n >> m;
    int dx,dy;
    int x=0,y=0;
    int a,b;
    for (int i=0;i<n;i++) {
        cin>>dx>>dy;
        x+=dx;
        y+=dy;
    }
    for (int i=0;i<m;i++) {
        cin>>a>>b;
        cout<<a+x<<" "<<b+y<<endl;
    }
    return 0;
}